<?php

namespace src\Util;

class GetRemoteOS{

    public $remote_os; // remote system os

    public function __construct(){
        $userAgent = $_SERVER['HTTP_USER_AGENT'];
        $os_platform = "Unknown";
        $os_array = array(
            'Windows' => '/Win(3|6)4/i',
            'Linux' => '/Linux/i',
            'Mac OS X' => '/Macintosh|Mac OS X/i',
            'iPhone' => '/iPhone/i',
            'iPad' => '/iPad/i',
            'iPod' => '/iPod/i',
            'Android' => '/Android/i',
        );

        foreach ($os_array as $regex => $value) {
            if (preg_match($value, $userAgent)) {
                $os_platform = $regex;
                $this->remote_os = $os_platform;
            }
        }
    }
}